package com.javatest.springboot2kafka.kafka;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @date 2021-03-02 下午4:43
 */
@Component
public class KafkaConsumer {
    private static final Logger LOGGER = LoggerFactory.getLogger(KafkaConsumer.class);
    private static final String MY_TOPIC = "my-test";

    @KafkaListener(topics = {MY_TOPIC}, groupId = "group1")
    public void listen(String msg) {
        LOGGER.info("kafka监听的值是：{}", msg);
    }

}
